package com.hxit.contorller;

import com.hxit.pojo.ConversationKnowledgeBase;
import com.hxit.pojo.Result;
import com.hxit.servics.ConversationKnowledgeBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName ConversationKnowledgeBaseController
 * @Author 12694
 * @Date 2024/11/18 20:59
 * @Version 1.0
 **/
@RestController
@Slf4j
@RequestMapping("/conversationKnowledgeBase")
public class ConversationKnowledgeBaseController {
    @Autowired
    private ConversationKnowledgeBaseService conversationKnowledgeBaseService;

    /**
     * 增加对话知识点
     */
    @PostMapping("/insert")
    public Result insertConversationKnowledgeBase(@RequestBody ConversationKnowledgeBase conversationKnowledgeBase) {
        log.info("增加对话知识点");
        conversationKnowledgeBaseService.insertConversationKnowledgeBase(conversationKnowledgeBase);
        return Result.success();
    }
    /**
     * 查询对话知识点
     */
    @GetMapping
    public Result selectConversationKnowledgeBase() {
        log.info("查询对话知识点");
        List<ConversationKnowledgeBase> list=conversationKnowledgeBaseService.selectConversationKnowledgeBase();
        return Result.success(list);
    }

    /**
     * 删除对话知识点
     * @return
     */
    @DeleteMapping
    public Result deleteConversationKnowledgeBase(@RequestBody ConversationKnowledgeBase conversationKnowledgeBase) {
        log.info("删除对话知识点");
        conversationKnowledgeBaseService.deleteConversationKnowledgeBase(conversationKnowledgeBase);
        return Result.success();
    }
}
